package com.test;

import com.pojo.user;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.*;
import org.junit.jupiter.api.Test;

import java.io.Reader;
import java.sql.Connection;

public class userTest {
    @Test
    public void userFindByIdTest(){
        String resources = "mybatis-config.xml";
        Reader reader = null;
        try {
            reader = Resources.getResourceAsReader(resources);
        }catch (Exception e){
            e.printStackTrace();
        }
        SqlSessionFactory sqlMapper=
                new SqlSessionFactoryBuilder().build(reader);
        SqlSession sqlSession = sqlMapper.openSession();
        user user = sqlSession.selectOne("findById",1);
        System.out.println(user.getUname());
        sqlSession.getClass();
    }
}
